Skip to content

Conversation

@macpie
Copy link
Member

@macpie macpie commented Oct 28, 2025

  • Re-organize code similar to Mobile Config
    • All CLI is broken up
    • Any gateway related modules goes under gateway/
  • Instead of Gateways being queried directly from Metadata DB they are now stored in IOT Config's Postgres by gateway/tracker
  • Rewrite old APIs to use new Gateway DB.
  • Tests were written before update so I could make sure they passed before and after we got all the gateways in IOT Config's Postgres.
  • Related Proto update Add iot config info_stream_v2 proto#467

@macpie macpie force-pushed the macpie/iot_config_gateway_v2 branch from af6c6c3 to 770f289 Compare October 29, 2025 19:08
@macpie macpie marked this pull request as ready for review October 29, 2025 19:08
@macpie macpie force-pushed the macpie/iot_config_gateway_v2 branch from fac8be3 to 06a07e0 Compare October 29, 2025 19:30
@macpie macpie force-pushed the macpie/iot_config_gateway_v2 branch from 06a07e0 to abb42a9 Compare November 17, 2025 18:04
.signing_keypair()
.map(|keypair| keypair.public_key().to_string())?;
tracing::debug!("listening on {listen_addr}");
tracing::debug!("signing as {pubkey}");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@bbalser Do we want take this opportunity to log the settings?

let (tx, rx) = tokio::sync::mpsc::channel(20);

tokio::spawn(async move {
let epoch: DateTime<Utc> = "1970-01-01T00:00:00Z".parse().unwrap();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

chrono provides a constant for the epoch.

DateTime::UNIX_EPOCH;

Also, DateTime::<Utc>::default() is UNIX_EPOCH. We could consider passing epoch as an Option<DateTime<Utc>> to stream_all_gateways_info and .unwrap_or_default() when it's empty if that's more readable.


I don't know we're gaining anything from this function being called in a tokio::select! with a single branch.

.bind(min_last_changed_at)
.bind(min_location_changed_at)
.fetch(db)
.map_err(anyhow::Error::from)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we be .inspect_err() here so we're not silently ignoring potential errors?

biased;
_ = &mut shutdown => break,
_ = interval.tick() => {
if let Err(err) = execute(&self.pool, &self.metadata).await {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We don't want to propagate this err and crash the service if it happens?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants